<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">

      <el-form-item label="用户账号" prop="account">
        <el-input
          v-model="queryParams.account"
          placeholder="请输入用户账号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户昵称" prop="nickName">
        <el-input
          v-model="queryParams.nickName"
          placeholder="请输入用户昵称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户邮箱" prop="email">
        <el-input
          v-model="queryParams.email"
          placeholder="请输入用户邮箱"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号码" prop="phoneNumber">
        <el-input
          v-model="queryParams.phoneNumber"
          placeholder="请输入手机号码"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="用户性别" prop="sex">
        <el-select v-model="queryParams.sex" placeholder="请选择用户性别" clearable>
          <el-option
            v-for="dict in dict.type.sys_user_sex"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="帐号状态" prop="status">
        <el-select v-model="queryParams.status" placeholder="请选择帐号状态" clearable>
          <el-option
            v-for="dict in dict.type.sys_normal_disable"
            :key="dict.value"
            :label="dict.label"
            :value="dict.value"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="证件号" prop="idNumber">
        <el-input
          v-model="queryParams.idNumber"
          placeholder="请输入证件号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="紧急联系人名字" prop="guardianName">
        <el-input
          v-model="queryParams.guardianName"
          placeholder="请输入紧急联系人名字"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="紧急联系人手机" prop="guardianPhone">
        <el-input
          v-model="queryParams.guardianPhone"
          placeholder="请输入紧急联系人手机"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="家庭住址" prop="address">
        <el-input
          v-model="queryParams.address"
          placeholder="请输入家庭住址"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="真实姓名" prop="realName">
        <el-input
          v-model="queryParams.realName"
          placeholder="请输入真实姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['customer:management:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['customer:management:edit']"
        >修改
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['customer:management:remove']"
        >删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['customer:management:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table
      v-loading="loading"
      :data="managementList"
      @selection-change="handleSelectionChange"
      border
      stripe
      highlight-current-row
      style="width: 100%"
      :header-cell-style="{background:'#f5f7fa', color:'#606266'}"
    >
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="用户信息" align="center" min-width="200">
        <template slot-scope="scope">
          <div class="user-info">
            <el-avatar
              shape="circle"
              size="small"
              :src="scope.row.avatar"
              class="user-avatar"
            >
              <img src="@/assets/images/profile.jpg" alt="默认头像" />
            </el-avatar>
            <div class="user-details">
              <div class="user-name">{{ scope.row.realName }}</div>
              <div class="user-account">{{ scope.row.account }}</div>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="联系方式" align="center" min-width="180">
        <template slot-scope="scope">
          <div class="contact-info">
            <div class="contact-item">
              <i class="el-icon-phone"></i>
              <span>{{ scope.row.phoneNumber || '未填写' }}</span>
            </div>
            <div class="contact-item">
              <i class="el-icon-message"></i>
              <span>{{ scope.row.email || '未填写' }}</span>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="基本信息" align="center" min-width="150">
        <template slot-scope="scope">
          <div class="basic-info">
            <div class="info-item">
              <span class="info-label">性别:</span>
              <dict-tag :options="dict.type.sys_user_sex" :value="scope.row.sex"/>
            </div>
            <div class="info-item">
              <span class="info-label">生日:</span>
              <span>{{ parseTime(scope.row.birthDate, '{y}-{m}-{d}') || '未填写' }}</span>
            </div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="身高/体重" align="center" width="120">
        <template slot-scope="scope">
          <div class="physical-info">
            <div class="height">{{ scope.row.height || '--' }}cm</div>
            <div class="weight">{{ scope.row.weight || '--' }}kg</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column label="状态" align="center" width="100">
        <template slot-scope="scope">
          <el-switch
            v-model="scope.row.status"
            active-value="0"
            inactive-value="1"
            active-color="#13ce66"
            inactive-color="#ff4949"
            @change="handleStatusChange(scope.row)"
          ></el-switch>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button-group>
            <el-button
              size="mini"
              type="primary"
              plain
              @click="handleGlossoscopy(scope.row)"
              v-hasPermi="['customer:management:customerBind']"
            >舌诊
            </el-button>
            <el-button
              size="mini"
              type="success"
              plain
              @click="handleCustomerBind(scope.row)"
              v-hasPermi="['customer:management:customerBind']"
            >绑定家人
            </el-button>
            <el-button
              size="mini"
              type="warning"
              plain
              @click="handleDeviceBind(scope.row)"
              v-hasPermi="['customer:management:deviceBind']"
            >绑定设备
            </el-button>
            <el-button
              size="mini"
              type="warning"
              plain
              @click="goToExamine(scope.row)"
            >去体检
            </el-button>
            <el-dropdown trigger="click" @command="(command) => handleCommand(command, scope.row)">
              <el-button size="mini" type="info" plain>
                更多<i class="el-icon-arrow-down el-icon--right"></i>
              </el-button>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item command="address">收货地址</el-dropdown-item>
                <el-dropdown-item command="update">修改</el-dropdown-item>
                <el-dropdown-item command="delete">删除</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-button-group>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改客户管理对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-tabs v-model="activeTab">
          <el-tab-pane label="基本信息" name="basic">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="真实姓名" prop="realName">
                  <el-input v-model="form.realName" placeholder="请输入真实姓名"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="用户账号" prop="account">
                  <el-input v-model="form.account" placeholder="请输入用户账号"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item v-if="form.id == undefined" label="用户密码" prop="password">
                  <el-input v-model="form.password" placeholder="请输入用户密码" type="password" maxlength="20" show-password/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="出生日期" prop="birthDate">
                  <el-date-picker clearable
                                  v-model="form.birthDate"
                                  type="date"
                                  value-format="yyyy-MM-dd"
                                  placeholder="请选择出生日期"
                                  style="width: 100%;">
                  </el-date-picker>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="用户昵称" prop="nickName">
                  <el-input v-model="form.nickName" placeholder="请输入用户昵称"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="用户性别" prop="sex">
                  <el-radio-group v-model="form.sex">
                    <el-radio
                      v-for="dict in dict.type.sys_user_sex"
                      :key="dict.value"
                      :label="dict.value"
                    >{{ dict.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="用户邮箱" prop="email">
                  <el-input v-model="form.email" placeholder="请输入用户邮箱"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="手机号码" prop="phoneNumber">
                  <el-input v-model="form.phoneNumber" placeholder="请输入手机号码"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-tab-pane>

          <el-tab-pane label="详细信息" name="detail">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身份证类型" prop="idType">
                  <el-select v-model="form.idType" placeholder="请选择身份证类型" style="width: 100%;">
                    <el-option
                      v-for="dict in dict.type.id_type"
                      :key="dict.value"
                      :label="dict.label"
                      :value="dict.value"
                    ></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号" prop="idNumber">
                  <el-input v-model="form.idNumber" placeholder="请输入证件号"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="紧急联系人" prop="guardianName">
                  <el-input v-model="form.guardianName" placeholder="请输入紧急联系人名字"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="联系人手机" prop="guardianPhone">
                  <el-input v-model="form.guardianPhone" placeholder="请输入紧急联系人手机"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="身高(cm)" prop="height">
                  <el-input v-model="form.height" placeholder="请输入身高"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="体重(kg)" prop="weight">
                  <el-input v-model="form.weight" placeholder="请输入体重"/>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="家庭住址" prop="address">
                  <el-input v-model="form.address" placeholder="请输入家庭住址"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-tab-pane>

          <el-tab-pane label="状态设置" name="status">
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="部门ID" prop="deptId">
                  <el-input v-model="form.deptId" placeholder="请输入部门ID"/>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="帐号状态" prop="status">
                  <el-radio-group v-model="form.status">
                    <el-radio
                      v-for="dict in dict.type.sys_normal_disable"
                      :key="dict.value"
                      :label="dict.value"
                    >{{ dict.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="12">
                <el-form-item label="删除标志" prop="delFlag">
                  <el-radio-group v-model="form.delFlag">
                    <el-radio
                      v-for="dict in dict.type.delete_flag"
                      :key="dict.value"
                      :label="dict.value"
                    >{{ dict.label }}
                    </el-radio>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row :gutter="20">
              <el-col :span="24">
                <el-form-item label="备注" prop="remark">
                  <el-input v-model="form.remark" placeholder="请输入备注" type="textarea" :rows="3"/>
                </el-form-item>
              </el-col>
            </el-row>
          </el-tab-pane>
        </el-tabs>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>


<script>
import {addManagement, delManagement, getManagement, listManagement, updateManagement} from '@/api/customer/management'

import {goToExamine} from '@/api/customer/zkxcUser';

export default {
  name: 'Management',
  dicts: ['sys_user_sex', 'sys_normal_disable', 'id_type', 'delete_flag'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 客户管理表格数据
      managementList: [],
      // 弹出层标题
      title: '',
      // 是否显示弹出层
      open: false,
      accountOpen: false,
      initPassword:undefined,
      activeTab: 'basic',
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        deptId: null,
        account: null,
        nickName: null,
        email: null,
        phoneNumber: null,
        sex: null,
        avatar: null,
        status: null,
        idType: null,
        idNumber: null,
        guardianName: null,
        guardianPhone: null,
        address: null,
        realName: null,
        weight: null,
        height: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        realName: [
          { required: true, message: '用户姓名不能为空', trigger: 'blur' },
        ],
        account: [
          { required: true, message: '用户账号不能为空', trigger: 'blur' },
          { min: 2, max: 20, message: '用户账号长度必须介于 2 和 20 之间', trigger: 'blur' }
        ],
        nickName: [
          { required: true, message: '用户昵称不能为空', trigger: 'blur' }
        ],
        email: [
          {
            type: "email",
            message: "请输入正确的邮箱地址",
            trigger: ["blur", "change"]
          }
        ],
        password: [
          { required: true, message: "用户密码不能为空", trigger: "blur" },
          { min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' },
          { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符：< > \" ' \\\ |", trigger: "blur" }
        ],
        phoneNumber: [
          {
            pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
            message: "请输入正确的手机号码",
            trigger: "blur"
          }
        ],
        height: [
          { required: true, message: '请输入身高', trigger: 'blur' },
          { pattern: /^\d+(\.\d{1,2})?$/, message: '身高格式不正确', trigger: 'blur' }
        ],
        weight: [
          { required: true, message: '请输入体重', trigger: 'blur' },
          { pattern: /^\d+(\.\d{1,2})?$/, message: '体重格式不正确', trigger: 'blur' }
        ]
      }
    }
  },
  created() {
    this.getList()
    this.getConfigKey("sys.user.initPassword").then(response => {
      this.initPassword = response.msg;
    });
  },
  methods: {
    // 用户状态修改
    handleStatusChange(row) {
      let text = row.status === "0" ? "启用" : "停用";
      this.$modal.confirm('确认要"' + text + '""'  + row.account+ '"客户吗？').then(function() {
        const id=row.id,status=row.status
        return updateManagement({id, status});
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess(text + "成功");
      }).catch(function() {
        row.status = row.status === "0" ? "1" : "0";
      });
    },
    /** 查询客户管理列表 */
    getList() {
      this.loading = true
      listManagement(this.queryParams).then(response => {
        this.managementList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        deptId: null,
        account: null,
        nickName: null,
        email: null,
        phoneNumber: null,
        sex: null,
        avatar: null,
        status: null,
        remark: null,
        idType: null,
        idNumber: null,
        guardianName: null,
        guardianPhone: null,
        address: null,
        delFlag: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        realName: null,
        weight: null,
        height: null,
        password:null,
        birthDate:null

      }
      this.resetForm('form')
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm('queryForm')
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },

    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = '添加客户管理'
      this.form.password = this.initPassword;
      this.activeTab = 'basic';
    },
    /** 收货地址按钮操作 */
    handleAddress(row) {
      const id = row.id || this.ids
      this.$router.push('/customer/shippingAddress/index/' + id)
    },
    /** 绑定设备按钮操作 */
    handleGlossoscopy(row) {
      this.popupVisible=true
    },
    /** 绑定设备按钮操作 */
    handleCustomerBind(row) {
      const id = row.id || this.ids
      this.$router.push('/customer/customerBind/index/' + id)
    },
    /** 绑定设备按钮操作 */
    handleDeviceBind(row) {
      const id = row.id || this.ids
      this.$router.push('/customer/customerDeviceBind/index/' + id)
    },
    /** 添加体检用户 */
    goToExamine(row) {
      const id = row.id || this.ids
      debugger
      if (!row.idNumber || !row.birthDate) {
        this.$modal.msgError('请先完善客户 身份证/生日 信息！')
        return
      }

      goToExamine(id).then(response => {
        this.$modal.msgSuccess(response.msg)
      })
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const id = row.id || this.ids
      getManagement(id).then(response => {
        this.form = response.data
        this.open = true
        this.title = '修改客户管理'
        this.form.password = "";
        this.activeTab = 'basic';
      })
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs['form'].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateManagement(this.form).then(response => {
              this.$modal.msgSuccess('修改成功')
              this.open = false
              this.getList()
            })
          } else {
            addManagement(this.form).then(response => {
              this.$modal.msgSuccess('新增成功')
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids
      this.$modal.confirm('是否确认删除客户管理编号为"' + ids + '"的数据项？').then(function() {
        return delManagement(ids)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess('删除成功')
      }).catch(() => {
      })
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/management/export', {
        ...this.queryParams
      }, `management_${new Date().getTime()}.xlsx`)
    },
    /** 导入设备按钮操作 */
    handleImport() {
      // 这里添加导入设备的逻辑
      this.$modal.msgInfo('导入设备功能待实现');
    },
    /** 更多操作下拉菜单 */
    handleCommand(command, row) {
      switch (command) {
        case 'address':
          this.handleAddress(row);
          break;
        case 'update':
          this.handleUpdate(row);
          break;
        case 'delete':
          this.handleDelete(row);
          break;
      }
    }
  }
}
</script>

<style scoped lang="scss">
.app-container {
  background-color: #f0f2f5;
  padding: 20px;
  min-height: calc(100vh - 84px);
}

.search-container {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.search-form {
  .el-form-item {
    margin-bottom: 15px;
  }
}

.search-actions {
  text-align: right;
  padding-top: 10px;
}

.toolbar-container {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.table-container {
  background: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.user-info {
  display: flex;
  align-items: center;

  .user-avatar {
    margin-right: 12px;
  }

  .user-details {
    text-align: left; /* 添加这行使文字靠左对齐 */
    .user-name {
      font-weight: 600;
      font-size: 15px;
      color: #303133;
      margin-bottom: 4px;
    }

    .user-account {
      font-size: 13px;
      color: #909399;
    }
  }
}

.contact-info {
  .contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;

    &:last-child {
      margin-bottom: 0;
    }

    i {
      margin-right: 6px;
      color: #409eff;
      font-size: 14px;
    }

    span {
      font-size: 13px;
      color: #606266;
    }
  }
}

.basic-info {
  .info-item {
    display: flex;
    align-items: center;
    margin-bottom: 6px;

    &:last-child {
      margin-bottom: 0;
    }

    .info-label {
      font-weight: 500;
      margin-right: 6px;
      color: #606266;
      font-size: 13px;
    }

    span {
      font-size: 13px;
      color: #303133;
    }
  }
}

.physical-info {
  .height, .weight {
    font-size: 15px;
    font-weight: 500;
    color: #303133;
    margin-bottom: 4px;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .height {
    color: #409eff;
  }

  .weight {
    color: #67c23a;
  }
}

.pagination-container {
  padding: 20px;
  border-radius: 8px;
  background-color: transparent !important;
}

.el-dialog__body {
  padding: 15px 20px;
}

.el-tabs {
  .el-tab-pane {
    padding: 15px 0;
  }
}

// 美化表格中的按钮
.el-button-group {
  display: flex;
  flex-wrap: wrap;

  .el-button {
    border-radius: 4px !important;
    padding: 6px 12px;
    font-size: 12px;
    margin: 2px;
    transition: all 0.3s;
    border: 1px solid transparent;

    // 主要按钮
    &.el-button--primary {
      background: #ecf5ff;
      color: #409eff;
      border-color: #b3d8ff;

      &:hover {
        background: #409eff;
        color: #ffffff;
        border-color: #409eff;
      }
    }

    // 成功按钮
    &.el-button--success {
      background: #f0f9eb;
      color: #67c23a;
      border-color: #c2e7b0;

      &:hover {
        background: #67c23a;
        color: #ffffff;
        border-color: #67c23a;
      }
    }

    // 警告按钮
    &.el-button--warning {
      background: #fdf6ec;
      color: #e6a23c;
      border-color: #f5dab1;

      &:hover {
        background: #e6a23c;
        color: #ffffff;
        border-color: #e6a23c;
      }
    }

    // 信息按钮（下拉按钮）
    &.el-button--info {
      background: #f4f4f5;
      color: #909399;
      border-color: #d3d4d6;

      &:hover {
        background: #909399;
        color: #ffffff;
        border-color: #909399;
      }
    }
  }
}

// 美化下拉菜单
.el-dropdown-menu {
  border-radius: 6px;
  padding: 6px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #ebeef5;

  .el-dropdown-menu__item {
    padding: 8px 16px;
    font-size: 13px;
    transition: all 0.2s;

    &:hover {
      background-color: #f5f7fa;
      color: #409eff;
    }

    &.el-dropdown-menu__item--divided {
      margin-top: 6px;
      border-top: 1px solid #ebeef5;
    }
  }
}

// 美化对话框按钮
.dialog-footer {
  .el-button {
    border-radius: 6px;
    padding: 9px 20px;
    font-size: 13px;
    transition: all 0.3s;

    // 取消按钮
    &:first-child {
      border-color: #dcdfe6;
      color: #606266;

      &:hover {
        background-color: #f5f7fa;
        border-color: #c0c4cc;
      }
    }

    // 确定按钮
    &:last-child {
      background: linear-gradient(135deg, #409eff, #1a73e8);
      border-color: #409eff;
      box-shadow: 0 2px 6px rgba(64, 158, 255, 0.3);

      &:hover {
        background: linear-gradient(135deg, #66b1ff, #409eff);
        box-shadow: 0 4px 10px rgba(64, 158, 255, 0.4);
        transform: translateY(-1px);
      }
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .toolbar-container {
    .el-col {
      width: 33.33%;
      margin-bottom: 10px;
    }
  }

  .table-container {
    padding: 10px;
  }

  .user-info {
    flex-direction: column;
    text-align: center;

    .user-avatar {
      margin-right: 0;
      margin-bottom: 8px;
    }
  }
}
</style>


